<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">
        <ui:define name="title">
            <h:outputText value="Convert Sales Inquiry # #{salesInquiryEntityController.selected.id} to Sales Quotation"></h:outputText>
        </ui:define>
        <ui:define name="content">
            <h:form rendered="#{loginBacking.convertSalesInquiry}">
                <p:panel header="Convert Sales Inquiry # #{salesInquiryEntityController.selected.id} to Sales Quotation">
                    <p:messages />
                    <br />
                    <h:panelGrid columns="6">

                        <h:outputText value="#{bundle.ViewSalesInquiryEntityLabel_salesLead}" rendered="#{salesInquiryEntityController.selected.salesLead!=null}"/>
                        <p:commandLink value="#{salesInquiryEntityController.selected.salesLead.firstName}&nbsp;#{salesInquiryEntityController.selected.salesLead.lastName}" action="#{salesLeadEntityController.viewSalesLeadFromInquiry}" rendered="#{salesInquiryEntityController.selected.salesLead!=null}" ajax="false"/>
                        <h:outputText value="" rendered="#{salesInquiryEntityController.selected.salesLead!=null}"/>
                        <h:outputText value="" rendered="#{salesInquiryEntityController.selected.salesLead!=null}"/>
                        <h:outputText value="Sales Lead Id:" rendered="#{salesInquiryEntityController.selected.salesLead!=null}"/>
                        <h:outputText value="#{salesInquiryEntityController.selected.salesLead}" rendered="#{salesInquiryEntityController.selected.salesLead!=null}"/>

                        <h:outputText value="#{bundle.ViewSalesInquiryEntityLabel_customer}" rendered="#{salesInquiryEntityController.selected.customer!=null}"/>
                        <p:commandLink value="#{salesInquiryEntityController.selected.customer.firstName}&nbsp;#{salesInquiryEntityController.selected.customer.lastName}" action="#{customerEntityController.viewCustomerFromInquiry}" rendered="#{salesInquiryEntityController.selected.customer!=null}" ajax="false"/>
                        <h:outputText value="" rendered="#{salesInquiryEntityController.selected.customer!=null}"/>
                        <h:outputText value="" rendered="#{salesInquiryEntityController.selected.customer!=null}"/>
                        <h:outputText value="Customer Id:" rendered="#{salesInquiryEntityController.selected.customer!=null}"/>
                        <h:outputText value="#{salesInquiryEntityController.selected.customer}" title="#{bundle.ViewSalesInquiryEntityTitle_customer}" rendered="#{salesInquiryEntityController.selected.customer!=null}"/>
                    </h:panelGrid>

                    <h:panelGrid columns="2">
                        <h:outputLabel value="Product:" style="font-weight:bold"/>
                        <h:outputLabel value="Quantity (Number of Case(s)):" style="font-weight:bold"/>

                        <h:outputLabel value="Classic Nutri Bar (Nuts)" for="product" />
                        <p:inputText id="quantity" binding="#{quantity1}" value="#{salesQuotationEntityController.selectedPQP.quantity}" title="#{bundle.CreateProductQuantityPriceEntityTitle_quantity}" />

                        <h:outputLabel value="Classic Nutri Bar (Fruits)" for="product" />
                        <p:inputText id="quantity2" binding="#{quantity2}" value="#{salesQuotationEntityController.selectedPQP2.quantity}" title="#{bundle.CreateProductQuantityPriceEntityTitle_quantity}" />

                        <h:outputLabel value="Premium Power Bar (Chocolate Nuts)" for="product" />
                        <p:inputText id="quantity3" binding="#{quantity3}" value="#{salesQuotationEntityController.selectedPQP3.quantity}" title="#{bundle.CreateProductQuantityPriceEntityTitle_quantity}" />

                        <h:outputLabel value="Premium Power Bar (Redcurrant Fruits)" for="product" />
                        <p:inputText id="quantity4" value="#{salesQuotationEntityController.selectedPQP4.quantity}" title="#{bundle.CreateProductQuantityPriceEntityTitle_quantity}" >
                            <f:validator validatorId="macTeam.ProductQuantityInputValidator"/>
                            <f:attribute name="quantity1" value="#{quantity1.value}" />
                            <f:attribute name="quantity2" value="#{quantity2.value}" />
                            <f:attribute name="quantity3" value="#{quantity3.value}" />
                        </p:inputText>
                        <h:message styleClass="errorMsg" for= "quantity4" />
                    </h:panelGrid>
                </p:panel>
                <p:commandButton action="#{salesQuotationEntityController.performConvert}" value="Convert Now" ajax="false"/>
                &nbsp;
                <p:commandButton action="View" value="Cancel" immediate="true" ajax="false"/>
                &nbsp;
                <p:commandButton action="#{salesInquiryEntityController.prepareList}" value="Show All Inquiries" immediate="true" ajax="false"/>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
